import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { RadioButtonGroup } from "../../../../../fl/controls/RadioButtonGroup";
import { GRadioButton } from "../../../../../com/mui/controls/GRadioButton";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SActiveToClient } from "../../../../../Message/Public/SActiveToClient";
import { JSONHelper } from "../../../../../com/mui/serialization/json/JSONHelper";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class DramaMultipleDelegatePanel
    
    export  class DramaMultipleDelegatePanel extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            this._radioDatas = [{"name":"radio1", "value": 1, "label": Language.getString(69720)}, {"name":"radio2", "value": 2, "label": Language.getString(69721)}, {"name":"radio3", "value": 3, "label": Language.getString(69722)}];
            super(arg1);
            this.setSize(300, 234);
            this.titleHeight = 25;
            this.title = ObjCreate.createTitleTextField(Language.getString(69723));
            return;
        }

        protected /* override */ createChildren(): void
        {
            var loc1=null;
            var loc3=0;
            var loc4=null;
            var loc5=null;
            super.createChildren();
            ObjCreate.createBg(20, 38, 260, 182, this);
            loc1 = ObjCreate.createGTextField(Language.getString(69724), 30, 48, 240, 60, this, null, true, false);
            loc1.autoSize = flash.text.TextFieldAutoSize.LEFT;
            loc1.wordWrap = true;
            this._startDelegateBtn = ObjCreate.createGButton(Language.getString(69725), 112, 95, 76, 24, this);
            this._startDelegateBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onOptButtonClickHandler);
            this._radioGroup = new RadioButtonGroup("main");
            var loc2=this._radioDatas.length;
            while (loc3 < loc2) 
            {
                loc4 = this._radioDatas[loc3];
                (loc5 = ObjCreate.createRadioButton(loc4.label, 30, 135 + loc3 * 25, 240, 25, this, "GCheckBox")).value = loc4.value;
                loc5.name = loc4.name;
                loc5.group = this._radioGroup;
                if (loc3 == 0) 
                {
                    loc5.selected = true;
                }
                ++loc3;
            }
            return;
        }

        /* internal  */onOptButtonClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=this._radioGroup.selection as GRadioButton;
            Dispatcher.dispatchEvent(new DataEvent(EventName.DoDelegateDramaCopy, loc1.value));
            this.hide();
            return;
        }

        public updateCost(arg1: SActiveToClient): void
        {
            var loc1=JSONHelper.deserialize(arg1.modulus);
            if (loc1 == null) 
            {
                return;
            }
            var loc2=this._radioGroup.getRadioButtonAt(1) as GRadioButton;
            loc2.label = Language.getStringByParam(69721, loc1[2]);
            loc2 = this._radioGroup.getRadioButtonAt(2) as GRadioButton;
            loc2.label = Language.getStringByParam(69722, loc1[3]);
            return;
        }

        /* internal */ /* var */_startDelegateBtn: GButton;

        /* internal */ /* var */_radioGroup: RadioButtonGroup;

        /* internal */ /* var */_radioDatas: Array<any>;
    }
